package com.hdoit.apollo.logical.version.dao.impl;

import org.springframework.stereotype.Component;

import com.hdoit.apollo.logical.version.dao.IAndroidVersionDao;
import com.hdoit.apollo.logical.version.model.AndroidVersion;
import com.tennetcn.data.dao.base.ISqlExpression;
import com.tennetcn.data.dao.base.impl.SuperDao;
import com.tennetcn.data.enums.OrderEnum;
import com.tennetcn.data.utils.ClassAnnotationUtils;
import com.tennetcn.data.utils.SqlExpressionFactory;
/**
 * @author      tancongzhu
 * @email       
 * @createtime  2018年07月13日 15:05:20
 * @comment
 */
@Component
public class AndroidVersionDaoImpl extends SuperDao<AndroidVersion> implements IAndroidVersionDao{

	@Override
	public AndroidVersion getNewVersion() {
		ISqlExpression sqlExpression = SqlExpressionFactory.createExpression();
		sqlExpression.addBody("select * from " + ClassAnnotationUtils.getTableName(AndroidVersion.class))
						.andWhere("deleteMark = 1")
						.addOrder("versionCode", OrderEnum.desc)
						.limit(0, 1);
		return queryModel(sqlExpression);
	}

}